<template>
  <div>
    <div style="margin-bottom: 10px">
      <a-button @click="back">返回抽奖活动列表</a-button>
    </div>
    <search-table
      :url="url"
      ref="searchtable"
      :columns="columns"
      :form="form"
      :xLength="1000"
    >
      <template slot="searchForm">
        <a-form layout="inline" :form="form">
          <a-form-item label="抽奖类型">
            <a-select
              showSearch
              style="width: 160px"
              :options="activityTypeList"
              v-decorator="['activityType', { initialValue: '' }]"
              placeholder="请选择抽奖类型"
            >
            </a-select>
          </a-form-item>

          <a-form-item label="条件类型">
            <a-select
              showSearch
              style="width: 160px"
              :options="conditionTypeList"
              v-decorator="['conditionType', { initialValue: '' }]"
              placeholder="请选择条件类型"
            >
            </a-select>
          </a-form-item>
          <a-form-item label="活动名称">
            <a-input
              allowClear
              v-decorator="['activityName']"
              placeholder="请输入活动名称"
            ></a-input>
          </a-form-item>
          <a-form-item label="昵称或手机号">
            <a-input
              allowClear
              v-decorator="['keyword']"
              placeholder="请输入昵称或手机号"
            ></a-input>
          </a-form-item>
        </a-form>
      </template>
    </search-table>
  </div>
</template>
<script>
export default {
  name: "exchangeList",
  data() {
    return {
      url: "goldenhome/gh/lottery/admin_/lottery/number/page",
      form: this.$form.createForm(this, { name: "table_search" }),
      columns: [
        {
          title: "用户昵称",
          dataIndex: "customerName",
          key: "customerName",
        },
        {
          title: "手机号",
          dataIndex: "phoneNumber",
          key: "phoneNumber",
        },
        {
          title: "活动类型",
          dataIndex: "lotteryType",
          key: "lotteryType",
          customRender: (text, record) => {
            switch (text) {
              case 1:
                return "盲盒抽奖";
              default:
                return "";
            }
          },
        },
        {
          title: "活动名称",
          dataIndex: "activityName",
          key: "activityName",
        },
        {
          title: "操作时间",
          dataIndex: "createDate",
          key: "createDate",
          width: 180,
        },
        {
          title: "类型",
          dataIndex: "conditionType",
          key: "conditionType",
          customRender: (text, record) => {
            switch (text) {
              case 1:
                return "新人专享";
              case 2:
                return "免费抽奖";
              case 3:
                return "积分兑换";
              case 4:
                return "分享好友";
              case 5:
                return "分享朋友圈";
              case 6:
                return "购买指定商品";
              case 7:
                return "现金购买";
              case 8:
                return "单笔满抽";
              case 9:
                return "单笔递增满抽";
              case 10:
                return "口令兑换";
              default:
                return "";
            }
          },
        },
        {
          title: "类型详情",
          dataIndex: "content",
          align: "center",
        },
        {
          title: "增加次数",
          dataIndex: "addCount",
          key: "addCount",
          align: "center",
        },
      ],
      activityTypeList: [
        { value: "", label: "全部" },
        { value: 1, label: "盲盒抽奖" },
      ],
      conditionTypeList: [
        { value: "", label: "全部" },
        { value: 1, label: "新人专享" },
        { value: 2, label: "免费抽奖" },
        { value: 3, label: "积分兑换" },
        { value: 4, label: "分享好友" },
        { value: 5, label: "分享朋友圈" },
        { value: 6, label: "购买指定商品" },
        { value: 7, label: "现金购买" },
        { value: 8, label: "单笔满抽" },
        { value: 9, label: "单笔递增满抽" },
        { value: 10, label: "口令兑换" },
      ],
    };
  },
  methods: {
    back() {
      this.$router.push({
        name: "MarketingLottery",
      });
    },
  },
};
</script>
<style lang="less" scoped>
</style>